/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.product.store;

import java.sql.Date;
import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.S200;
import queenb.net.entitybean.S400;
import queenb.web.util.PackageContants;

/**
 *
 * @author Nguyen Hung
 */
public class S400Store extends S400 {

    public List<S400> LISTOFTABS400(int pnFH000, int pnFH200, int pnFS400, int pnSDATE, int pnSMONT, int pnSYEAR, int pnFA000F, int pnFA000T, int pnSN204, String pvLOGIN) {
        DataStatement dataStatement = new DataStatement(PackageContants.LIST_S400PRO, OracleTypes.CURSOR, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.INTEGER, pnFS400),
                    new Param(OracleTypes.INTEGER, pnSDATE),
                    new Param(OracleTypes.INTEGER, pnSMONT),
                    new Param(OracleTypes.INTEGER, pnSYEAR),
                    new Param(OracleTypes.INTEGER, pnFA000F),
                    new Param(OracleTypes.INTEGER, pnFA000T),
                    new Param(OracleTypes.INTEGER, pnSN204),
                    new Param(OracleTypes.CHAR, pvLOGIN),});
        try {
            return super.find(dataStatement, S400.class);
        } catch (SQLException ex) {
            Logger.getLogger(S400Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(S400Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(S400Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }

    }
    //

    public int STORNOTABS400(int pnPS400, String pvLOGIN) {
        try {

            DataStatement dateStatement = new DataStatement(PackageContants.DELETE_S400, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnPS400),
                        new Param(OracleTypes.CHAR, pvLOGIN),});
            return super.update(dateStatement, null);
        } catch (SQLException ex) {
            Logger.getLogger(S400Store.class.getName()).log(Level.SEVERE, null, ex);
            return -1;
        }
    }
//

    public List<S400> LISTOFTABS400DE(int pnFH000, int pnFH200, int pnFS400, String pvLOGIN) {
        DataStatement dataStatement = new DataStatement(PackageContants.LIST_S400DE, OracleTypes.CURSOR, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.INTEGER, pnFS400),
                    new Param(OracleTypes.CHAR, pvLOGIN),});
        try {
            return super.find(dataStatement, S400.class);
        } catch (SQLException ex) {
            Logger.getLogger(S400Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(S400Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(S400Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }

    }

    //
    public int INSERTTABS400(int pnFH000, int pnFH200, int pnFA000F, int pnFA000T, int pnPS200, String pvSV201, Date pdSD202, String pvSV203, int pnSN204, String pvSV205, int pnSN206, int pnSN207, int pnSN208, String pvLOGIN) {
        try {
            DataStatement dateStatement = new DataStatement(PackageContants.UPDATE_S400PRO, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.INTEGER, pnFA000F),
                        new Param(OracleTypes.INTEGER, pnFA000T),
                        new Param(OracleTypes.INTEGER, pnPS200),
                        new Param(OracleTypes.CHAR, pvSV201),
                        new Param(OracleTypes.DATE, pdSD202),
                        new Param(OracleTypes.CHAR, pvSV203),
                        new Param(OracleTypes.INTEGER, pnSN204),
                        new Param(OracleTypes.CHAR, pvSV205),
                        new Param(OracleTypes.INTEGER, pnSN206),
                        new Param(OracleTypes.INTEGER, pnSN207),
                        new Param(OracleTypes.INTEGER, pnSN208),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.update(dateStatement, null);
        } catch (SQLException ex) {
            Logger.getLogger(S400Store.class.getName()).log(Level.SEVERE, null, ex);
            return -1;
        }

    }
    public int INSERTTABS400SGT(int pnFH000, int pnFH200, int pnFA000F, int pnFA000T, int pnPS200, String pvSV201, Date pdSD202, String pvSV203, int pnSN204, String pvSV205, int pnSN206, int pnSN207, int pnSN208,int pnSN409, String pvLOGIN) {
        try {
            DataStatement dateStatement = new DataStatement(PackageContants.UPDATE_S400SGT, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.INTEGER, pnFA000F),
                        new Param(OracleTypes.INTEGER, pnFA000T),
                        new Param(OracleTypes.INTEGER, pnPS200),
                        new Param(OracleTypes.CHAR, pvSV201),
                        new Param(OracleTypes.DATE, pdSD202),
                        new Param(OracleTypes.CHAR, pvSV203),
                        new Param(OracleTypes.INTEGER, pnSN204),
                        new Param(OracleTypes.CHAR, pvSV205),
                        new Param(OracleTypes.INTEGER, pnSN206),
                        new Param(OracleTypes.INTEGER, pnSN207),
                        new Param(OracleTypes.INTEGER, pnSN208),
                         new Param(OracleTypes.INTEGER, pnSN409),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.update(dateStatement, null);
        } catch (SQLException ex) {
            Logger.getLogger(S400Store.class.getName()).log(Level.SEVERE, null, ex);
            return -1;
        }

    }
    // TÙng
    public List<S400> LISTOFTABS400COMBO(int pnFH000, int pnFH200, int go,int to, String pvLOGIN) {
        DataStatement dataStatement = new DataStatement(PackageContants.COMBOBOX_S400, OracleTypes.CURSOR, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.INTEGER, go), 
                     new Param(OracleTypes.INTEGER, to), 
                    new Param(OracleTypes.CHAR, pvLOGIN),});
        try {
            return super.find(dataStatement, S400.class);
        } catch (SQLException ex) {
            Logger.getLogger(S400Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(S400Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(S400Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }

    }
}
